home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d962.lha / EnvTool / EnvTool.doc (.png) < prev    next >
ANSI Art File  |  1994-01-07  |  8KB  |  640x3536
Labels: text | screenshot | software | font
OCR: EnvTool v0.1 Placed in the public domain, by Dan Fish, 27-Dec-93 No rights reserved. Please freely-distribute this program! Enhance it, send it back to us for use with the AmigaLib library. (After all... it's to make the library better for you!) Amiga Library Services 610 N. Alma School Rd. Suite 18 Chandler, Az. 85224-3687 or Email to: fnfefishpond.cygnus.com EnvTool was born out of a severe need to allow Library users to specify their own tools for viewing docs, pictures, guide files, etc... instead of being forced to use the default tool specified in the supplied icon. (especially now with the "cast-in-plastic" tooltypes of the cdrom! ;) EnvTool allows the user to set environment variables for: "PAGER" "VIEWER" (to view text/doc type files) (to view picture type files) (for .Guide type files) (to edit files) "HYPERPAGER" "EDITOR" ... or anything else arrived upon by a "Standard" agreement of environment variable usage. Note: Amiga environment variables are not case-sensitive, but simply given here as such to follow the Unix convention. EnvTool is not the complete answer, but I believe it is a step in the right direction... For sample usage, quit now, and type: setenu PAGER=<complete path to your favorite file viewer> (Yes... I do realize that if you type that verbatim, it won't work! But I hope you know what I mean... if you don't, give up computers and become a lawyer! ;) and then double-click on the doc icon again. If all went well, you should be re-reading this file with your favorite file viewer, WITHOUT HAVING TO TOUCH THE ICON TOOLTYPES! In addition, sample usage for an IFF file is included... It defaults to SYS:Utilities/Display, but by setting an environment variable for "Viewer", it will be displayed using your preferred tool. Basically, it works like this... A project icon is set up with "EnuTool" as its default tool. Tooltypes control the operation from then on. If EnvTool is started with no tooltypes, the built-in "Default" operation is to send the file to SYS:Utilities/More. If a "DEFAULT" tooltype is specified it will send the file to that tool, and if an "ENU" tooltype is specified, the file will be sent to whatever tool the environment variable translates into. If the environment variable is not set, then the file will be sent to the "DEFAULT" tool (if specified) or else the built-in default. For example, assume an Doc icon has EnvTool as its default tool and the following tooltypes: ENU=PAGER DEFAULT=:c/MuchMore If you, the user, has something like: setenu PAGER=c:textread in your startup sequence, then the doc file will be displayed using "c: TextRead". If you don't have the PAGER environment variable set, then the file will be displayed using ":c/MuchMore" IMPORTANT! IMPORTANT! IMPORTANT! IMPORTANT! IMPORTANT! IMPORTANT! As of this release, path's for the DEFAULT tooltype and ENV translations must be explicit! EnvTool does not inherit path/environment/alias information. Won't Work Use something like... Instead DEFAULT = More DEFAULT = SYS:Utilities/More setenu PAGER=c:MuchMore setenu PAGER-MuchMore I don't have a lot of time to work on this right now... Too busy working the next FFMCD and an icon placement utility to make our lives easier organizing the CD. (Not to mention my "normal" 50-hr a week job!) I've supplied the source so you can make it better... (and send it back to us for use on the CD of course!) The following ToolTypes are recognized. DEFAULT Tells EnvTool what the default tool for this project is... It will use this unless ENV is specified and the environment variable exists. Use an explicit path. Examples: DEFAULT = SYS:Utilities/More DEFAULT = c/MuchMore DEFAULT = SYS: Utilities/Display ENU Tells EnvTool what environment variable to look for and translate into a tool. If the environment variable is set, the file will be passed to the translation of the variable. Examples: ENU=PAGER ENU=EDITOR PREFIX Some tools need to be "Run" as a subprocess, others do just fine by passing the command itself to the system. EnuTool passes the command via DICE's system () function. I.E. a command for the DEFAULT example above might look like: error = system("SYS/Utilities/More Myfile.txt") for some tools (SYS:Utilities/More, for example) to work properly, this may need to be: error = system("Run SYS: Utilities/More Myfile.txt") Anything you place in the PREFIX tooltype will be "prefixed" onto the passed command. (a space is automatically added...you needn't specify one) Examples: PREFIX=RUN PREFIX=EXECUTE Works from the Workbench only... The system () function (DICE anyway...) returns −1 if it was unable to run the command, or whatever the return value from the command is. Most tools return (0) upon normal termination, and other codes for warnings/errors. If the return code is not (0), a requester will notify you of the command and the return code. (One such program appears to be SYS:Utilities/Display, which seems to display the picture normally, then give a return code of (1). Anybody know why??) I can think of several off-hand, most notably: * Needs to be made OS1.3 compatible, this is important since the FFMCD's are used on CDTV systems, and there are undoubtedly several (many?) users still using the older OS system. * CLI support (for scriptfiles and such...) * recognizing path/aliases, possibly a TOOLTYPE to selectively allow/disallow path/alias recognition. * Multiple ENV and DEFAULT tool checking, allowing several environ- ment variables to be tested for before applying specified defaults. Then allowing several defaults to be checked for in descending order before applying the builtin default. "Standard" tools vary in location from system to system and may vary from OS to OS. Since EnvTool uses the Find ToolType() function which will only return the first such specified tooltype, either an applicable substitute function will need to be written, or "Numbered defaults" will have to be used and tested for. For Example: ENU=AMIGALIBPAGER ENU_1=PAGER DEFAULT=SYS:Utilities/More DEFAULT_1=:bin/More DEFAULT_2=:c/More An offshoot of this may be testing to see if a particular tool is resident, and if so, using that tool instead of the path-specified tool. * Specifying "APP_TT"_tooltypes and having these passed to the end application. (I.E. APP_TT="TAB=4"). Granted, this could be a bit tricky because ENV could translate into one of may different tools, all of which could be looking for a different syntax within the tooltypes. Still, there are times when this could be quite useful... First (Alpha) Release NOTES: HISTORY: 27-Dec-93 Version 0.1